package com.barunsw.bwf.ems.common.scheduler;

import java.text.SimpleDateFormat;

import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.quartz.QuartzJobBean;

import com.barunsw.bwf.ems.sample.SampleService;

public class RunJob extends QuartzJobBean {
	
	private static final Logger logger = LoggerFactory.getLogger(RunJob.class);
	
	private SampleService sampleService;
	
	
	@Override
	protected void executeInternal(JobExecutionContext context) throws JobExecutionException {
		long time = System.currentTimeMillis();
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd HH:mm:ss");
		logger.info("[" + this + "] Start Job : " + sdf.format(time));
		
		try {
			//sampleService.getSampleList(null);
		} catch (Exception e) {
			logger.error("faild Job", e);
		}
		
		time = System.currentTimeMillis();
		logger.info("[" + this + "] End Job : " + sdf.format(time));
	}
	
	public void setSampleService(SampleService sampleService) {
		this.sampleService = sampleService;
	}
}